Fix TreeNodeFilter OR-pattern diagnostics#7415
Conversation
|
Merged latest Verification:
Ready for CI re-run and review. |
There was a problem hiding this comment.
Pull request overview
This PR clarifies TreeNodeFilter behavior for OR patterns and improves diagnostics when unsupported full-path OR expressions are parenthesized.
Changes:
- Adds regression coverage for single-segment OR patterns and exact-match behavior.
- Updates TreeNodeFilter grammar remarks and propagates filter text into parser error construction.
- Improves the unexpected slash diagnostic for parenthesized full-path OR patterns.
Show a summary per file
| File | Description |
|---|---|
test/UnitTests/Microsoft.Testing.Platform.UnitTests/Requests/TreeNodeFilterTests.cs |
Adds tests for supported OR syntax and unsupported parenthesized full-path OR diagnostics. |
src/Platform/Microsoft.Testing.Platform/Requests/TreeNodeFilter/TreeNodeFilter.cs |
Documents OR syntax limitations and augments the unexpected slash exception message. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 1
| throw new InvalidOperationException(PlatformResources.TreeNodeFilterUnexpectedSlashOperatorErrorMessage); | ||
| throw new InvalidOperationException( | ||
| $"{PlatformResources.TreeNodeFilterUnexpectedSlashOperatorErrorMessage} " | ||
| + $"Filter: '{filter}'. To combine alternatives for one path segment, use syntax like '/A/B/C/(X|Y)'."); |
There was a problem hiding this comment.
Moved the string to PlatformResources.resx as TreeNodeFilterUnexpectedSlashOperatorInPathSegmentErrorMessage so it's localized with the rest of the TreeNodeFilter diagnostics. XLFs regenerated via UpdateXlf.
There was a problem hiding this comment.
Verified this was already addressed on the branch; no further changes were needed in this pass.
The merge of origin/main into this branch brought in many new resx entries (IsGreaterThan, IsLessThan, IsPositive, IsNegative, IsInRange, Contains*, DoesNotContain*, ContainsSingle, etc.). Regenerated all 13 XLF files via 'dotnet msbuild /t:UpdateXlf' to keep them in sync. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the inline hint diagnostic appended to TreeNodeFilterUnexpectedSlashOperatorErrorMessage into a new PlatformResources entry (TreeNodeFilterUnexpectedSlashOperatorInPathSegmentErrorMessage) so the full message is localized like the surrounding parser diagnostics. XLFs regenerated via UpdateXlf. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| /// OR expressions are supported for a single path segment, for example: | ||
| /// <c>/A/B/C/(Test1|Test2)</c>. | ||
| /// | ||
| /// OR expressions over full paths are not supported, for example: | ||
| /// <c>(/A/B/C/Test1)|(/A/B/C/Test2)</c>. |
There was a problem hiding this comment.
Added the missing changelog entry in docs/Changelog-Platform.md in bc8c8cf so the PR description matches the branch again. Re-ran .\build.cmd successfully with 0 warnings and 0 errors.
There was a problem hiding this comment.
Verified this is addressed by bc8c8cf; .\build.cmd still passes locally.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Reviewed the outstanding feedback and pushed bc8c8cf. Addressed the remaining actionable Copilot comment by adding the missing Changelog-Platform.md entry, then re-ran .\build.cmd successfully (0 warnings, 0 errors). I did not make further code changes for the older Youssef review because it reads as a discussion note ('Let's discuss offline') rather than concrete change guidance, and I skipped the already-handled localization thread because Evangelink had already replied there. |
Description
Validation
Notes
This change does not expand grammar to support full-path OR in parentheses; it adds explicit guidance and test coverage for current supported syntax.